#!/bin/bash

cd /opt/etcloud/

FLAG=false
if [[ $1 == "im_server" ]]; then
	FLAG=true
fi

if [[ $1 == "log_server" ]]; then
	FLAG=true
fi

if [[ $1 == "ham_server" ]]; then
	FLAG=true
fi

ps -ef | grep $1 | grep -v install | grep -v grep

for PID in `ps -ef | grep $1 | grep -v install | grep -v grep | awk '{print $2}'`
do
 		kill -9 $PID
done

echo "rm $1"
rm -rf "$1"

echo "unzip $1.zip"
unzip "$1.zip"

ps -ef | grep $1 | grep -v install | grep -v grep

for PID in `ps -ef | grep $1 | grep -v install | grep -v grep | awk '{print $2}'`
do
 		kill -9 $PID
done

